package com.itheima.commons.model.vo;

import cn.hutool.core.convert.Convert;
import com.itheima.commons.model.domain.Questionnaire;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class QuestionnaireVo implements Serializable {

    private String id;//问卷编号
    private String name;//问卷名称
    private String cover;//封面
    private String level;//级别
    private Integer star;//星别
    private Integer isLock ;//是否锁住（0解锁，1锁住）
    private List<?> questions = Collections.emptyList();//试题

    public QuestionnaireVo(Questionnaire questionnaire, List list, Integer isLock) {
        this.isLock = isLock;
        this.id = questionnaire.getId().toString();
        this.name = questionnaire.getName();
        this.cover = questionnaire.getCover();
        this.level = questionnaire.getLevel();
        this.star = Convert.toInt(questionnaire.getStar());
        this.questions = list;
    }
}